<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/axios.min.js"></script>
    <script src="js/vue.js"></script>
</head>
<body>
<div>
    <input type="text" v-model="user.id" placeholder="id" readonly>
    <input type="text" v-model="user.username" placeholder="用户名">
    <input type="text" v-model="user.password" placeholder="密码">
    <input type="text" v-model="user.nick" placeholder="nick">
    <input type="button" value="修改" @click="update(user.id)">
</div>
<script>
    let v=new Vue({
        el:"div",
        data:{
            user:{id:"",username:"",password:"",nick:""}
        },
        created:function (){
            let id=location.search.split("=")[1];
            axios.get("/selectinid?id="+id).then(function (response){
                let u=response.data;
                alert(u)
                v.user=u;
            })
        },
        methods:{
            update(){
                axios.post("/update",v.user).then(function (response){
                    alert("修改成功");
                })
            }
        }
    })
</script>
</body>
</html>